package Operation;

import Personnel.Student;
import Class.ClassMate;

import java.sql.SQLOutput;
import java.util.Scanner;


public class AddOperation implements Ioperation{


    @Override
    public void work(ClassMate classmate) {
        System.out.println("新增学生！");
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入学生的姓名");
        String name = scanner.nextLine();
        System.out.println("输入学生的年龄");
        int age = scanner.nextInt();
        System.out.println("输入学生的身高");
        double height = scanner.nextDouble();
        System.out.println("输入学生的成绩");
        double grade = scanner.nextDouble();
        Student student = new Student(name,age,height,grade);
        int currentSize = classmate.getClassSize();
        classmate.setStudent(currentSize,student);
        classmate.setClassSize(currentSize + 1);
        System.out.println("新增学生成功！");
    }
}
